<template>
	<view>
		<view class="search">
			<view class="inputbox">
				<view class="search-box">
				<image :src="logo" mode="aspectFill"></image>
				<image src="/static/image/search.png" mode="aspectFill"></image>
				<input @input="textshow" :value="searchtext" maxlength="-1" placeholder="请输入查找内容" placeholder-style="#9e9e9e" />
				</view>
				<image v-if="searchtext" @click="clear" class="clear" src="/static/image/clear.png" mode="aspectFill"></image>
				<input placeholder="请输入查找内容" placeholder-style="#9e9e9e" class="search-input"/>
			</view>
			<view class="button">搜索</view>
		</view>
	</view>
</template>

<script>
	export default{
		props:{
			logo:{
				tpye:'String',
				default:'/static/image/taobao_logo.png'
			}
		},
		data(){
			return{
				searchtext:''
			}
		},
		methods:{
			textshow(e){
				this.searchtext =e.detail.value
			},
			clear(){
				this.searchtext =''
			}
		}
		
	}
</script>

<style lang="scss">
	.search {
		width: 100%;
		display: flex;
		justify-content: space-around;
		align-items: center;
		
		.button{
			font-size: 28rpx;
			color: #fff;
		}
		.inputbox {
			padding: 10rpx 20rpx;
			width: 80%;
			background-color: #fff;
			border-radius: 20rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;

			.search-box{
				display: flex;
				align-items: center;
				justify-content: flex-start;
				
				image {
					width: 30rpx;
					height: 30rpx;
					margin-right: 10rpx;
				}
			}
			.clear{
				width: 38rpx;
				height: 38rpx;
			}
			.search-input{
				
				font-size: 28rpx;
			}
			image {
				width: 30rpx;
				height: 30rpx;
				margin-right: 10rpx;

			}
		}
	}
</style>
